from django_filters import rest_framework as filters
from .models import MovieDetail


# class MovieInfoFilter(filters.FilterSet):
#     name = filters.CharFilter(lookup_expr='exact')
#     name_contains = filters.CharFilter(lookup_expr='contains',field_name='name')
#     #kind_category = filters.CharFilter(lookup_expr='id',field_name="kind_category__id")
#     class Meta:
#         model = MovieDetail
#         fields = ("name","kind_category","movie_state",'name_contains')

class MovieInfoFilter(filters.FilterSet):
    class Meta:
        model = MovieDetail
        fields = {
            'name': ['exact', 'contains'],
            'kind_category__name': ['exact', 'contains'],
            'kind_category__id': ['exact'],
            'movie_state__name': ['exact', 'contains'],
            'add_time': ['gte', 'lte']
        }
